<template>
  <div ref="provident" style=" width: 100%; height:500px" />
</template>

<script>
import * as echarts from 'echarts' // 引入所有的echarts
export default {
  props: {
    listChart: {
      type: Object,
      required: true
    }
  },
  mounted() {
    // 获取展示的数据 设置给图表
    this.myProvident = echarts.init(this.$refs.provident)
    this.drawProvident()
  },
  methods: {
    drawProvident() {
      const option = {
        xAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [this.listChart.monthlyOrderList],
            type: 'line'
          }
        ]
      }
      // 使用刚指定的配置项和数据显示图表。
      this.myProvident.setOption(option)
    }
  }
}
</script>

<style>

</style>
